<?php echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $title; ?></title>
<base href="<?php echo base_url(); ?>" />


<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>includes/js/jquery/ui/themes/ui-lightness/jquery-ui-1.8.9.custom.css" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>includes/css/elfinder.css" media="screen" />

<script type="text/javascript" src="<?php echo base_url(); ?>includes/js/jquery/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>includes/js/jquery/ui/jquery-ui-1.8.9.custom.min.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>includes/js/elfinder.min.js" charset="utf-8"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>includes/js/i18n/elfinder.<?php echo $lang; ?>.js" charset="utf-8"></script>


	<style type="text/css">
		#close, #open, #dock, #undock, #select {
			width: 100px;
			position:relative;
			float:right;
			display: -moz-inline-stack;
			display: inline-block;
			vertical-align: top;
			zoom: 1;
			*display: inline;
			margin:0 3px 3px 0;
			padding:1px 0;
			text-align:center;
			border:1px solid #ccc;
			background-color:#eee;
			margin:1em .5em;
			padding:.3em .7em;
			border-radius:5px; 
			-moz-border-radius:5px; 
			-webkit-border-radius:5px;
			cursor:pointer;
		}
	</style>
	

	<script type="text/javascript" charset="utf-8">
		$().ready(function() {
			
			var f = $('#finder').elfinder({
				url : '<?php echo $connector; ?>',
				lang : '<?php echo $lang; ?>',
				docked : false,
				height : 275,

				// dialog : {
				// 	title : 'File manager',
				// 	height : 500
				// }

				// Callback example
				editorCallback : function(url) {
					<?php if ($fckeditor) { ?>
					window.opener.CKEDITOR.tools.callFunction(<?php echo $fckeditor; ?>, url);
					
					self.close();	
					<?php } else { ?>
					//console.log(url);
					//console.log(decodeURIComponent(url));
					parent.$('#<?php echo $field; ?>').attr('value', decodeURIComponent(url.replace('<?php echo $directory; ?>', '')));
					parent.$('#dialog').dialog('close');
					
					parent.$('#dialog').remove();	
					<?php } ?>
				},
				closeOnEditorCallback : true
			});
			// window.console.log(f)
			$('#select').click(function() {
				$('#finder').elfinder($(this).attr('id'));
			})
			
		})
	</script>

</head>
<body>
	<div id="finder"></div>


</body>
</html>